FROM python:3.12
ARG HTTP_PROXY=""
ENV HTTPS_PROXY=$HTTP_PROXY
ENV HTTP_PROXY=$HTTP_PROXY

WORKDIR /app

# 设置时区
ENV TZ=Asia/Shanghai

# 使用清华镜像源
RUN sed -i 's/deb.debian.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apt/sources.list.d/debian.sources && \
    sed -i 's/security.debian.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apt/sources.list.d/debian.sources

# 配置pip镜像源

# 安装 poetry
RUN pip install poetry


# 复制项目文件
COPY pyproject.toml ./

# 安装依赖
RUN poetry config virtualenvs.create false \
    && poetry install --no-interaction --no-ansi

COPY . .

# 暴露端口
EXPOSE 8002

# 启动命令
CMD ["python", "manage.py", "runserver", "0.0.0.0:8002"]
